package com.sbl.bajw.pc.action;

import java.util.HashMap;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.sbl.bajw.common.web.JsonResultUtil;
import com.sbl.bajw.common.web.RequestUnit;
import com.sbl.bajw.pc.model.AuditModel;
import com.sbl.bajw.pc.service.AuditModelService;

@Controller
@RequestMapping("/Audit")
public class AuditModelAction {

	@Resource
	private AuditModelService service;
	
	/**
	 * @作者：罗琦
	 * @param request
	 * @param response
	 * @return 摄像头采集审核
	 */
	@RequestMapping(value = "/aduitCamera")
	public @ResponseBody String aduitCamera(HttpServletRequest request, HttpServletResponse response){
		AuditModel model = RequestUnit.getModel(AuditModel.class);
		service.auditCamera(model);
		String json = JsonResultUtil.Success();
		return json;
	}
	
	@RequestMapping(value = "/aduitCameraHouse")
	public @ResponseBody String aduitCameraHouse(HttpServletRequest request, HttpServletResponse response) throws Exception{
		AuditModel model = RequestUnit.getModel(AuditModel.class);
		service.auditCameraHouse(model);
		String json = JsonResultUtil.Success();
		return json;
	}
	
	@RequestMapping(value = "/processAlarm")
	public @ResponseBody String processAlarm(HttpServletRequest request, HttpServletResponse response){
		AuditModel model = RequestUnit.getModel(AuditModel.class);
		service.processAlarm(model);
		String json = JsonResultUtil.Success();
		return json;
	}
	
	@RequestMapping(value = "/auditDialog")
	public ModelAndView auditDialog(HttpServletRequest request, HttpServletResponse response){
		String tag = RequestUnit.getString("type");
		request.setAttribute("tag", tag);
		ModelAndView mav = new ModelAndView("/view/common/Audit");
		return mav;
	}
	
	/**
	 * 审核历史记录查询 
	 * @作者：罗琦
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/auditHistoryList")
	public @ResponseBody String auditHistoryList(HttpServletRequest request, HttpServletResponse response){
		HashMap<String, Object> parm = RequestUnit.getHashMapParmO();
		String json = service.getList(parm);
		return json;
	}
}
